<?php
	if (!session_start()) session_start();
	if (!isset($_SESSION['kiemtradangnhapthinguyet']) || $_SESSION['kiemtradangnhapthinguyet']!=1) {
		header('location: ../../../index.php');
		die();
	}
	$table = "tin_loai";
	$id = $_GET['id'];
	$kq=$qt->get_by_thutu($table,$id);
	$record=mysql_fetch_assoc($kq);
	if(isset($_POST['ok']))
	{	
		$id=$_POST['id'];
		$bien=$_POST;
		unset($bien['ok']);
		$res=$qt->updateObject1($table,$bien,"id='$id'");
		
		if($res){
			echo "<script>alert('Sửa dữ liệu thành công !!!');history.go(-2);</script>";
		}
	}
?>	
	
<script type="text/javascript">
function isTest() {
	if (document.getElementById("ten_vi").value=="") {
		alert("You have not entered enough information.");
		return false;
	}
	if (document.getElementById("ten_en").value=="") {
		alert("You have not entered enough information.");
		return false;
	}
	
    return true;
}	
</script>		
            	<div class="dangnhap_title">
                <a href="index.php" style="color:#F8991D;" title="Trang chủ">Trang chủ</a>
                <span style="font-size:9px;">>></span> 
                Thông tin khác
                <span style="font-size:9px;">>></span> 
                <a href="index.php?p=<?php echo $table; ?>_quanly" style="color:#F8991D;">Tin tổng hợp</a>  
            	</div>
            	<form method="post" action="index.php?p=<?php echo $table; ?>_sua" onSubmit="return isTest();">
            	<input type="hidden" name="id" value="<?php echo $id; ?>" />
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="font-size:22px; color:#0E6BBB; width: 90%;">
                        Vietnamese's Information
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Tên(*)
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="text" name="ten_vi" id="ten_vi" style="width:520px; padding:0px;" value="<?php echo $record['ten_vi']; ?>" />
                    </div>
                </div>
                <!--
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="width:710px; padding-bottom:3px;">
                        &nbsp; &nbsp; &nbsp;- Tóm tắt:
                    </div>
                    <div class="dangnhap_col_input" style="width:700px; padding-left:15px;">
                        <textarea id="tomtat_vi" name="tomtat_vi" rows="4" cols="30"><?php echo $record['tomtat_vi']; ?></textarea>
                    	<script type="text/javascript">
						var editor = CKEDITOR.replace( 'tomtat_vi',{
							uiColor : '#9AB8F3',
							language:'vi',
							skin:'office2003',
							//width:'200',
							filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?Type=Images',
							filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?Type=Flash',
							filebrowserImageUploadUrl :'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
							filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						});
						</script>
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="width:710px; padding-bottom:3px;">
                        &nbsp; &nbsp; &nbsp;- Nội dung:
                    </div>
                    <div class="dangnhap_col_input" style="width:700px; padding-left:15px;">
                        <textarea id="noidung_vi" name="noidung_vi" rows="4" cols="30"><?php echo $record['noidung_vi']; ?></textarea>
                    	<script type="text/javascript">
						var editor = CKEDITOR.replace( 'noidung_vi',{
							uiColor : '#9AB8F3',
							language:'vi',
							skin:'office2003',
							//width:'200',
							filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?Type=Images',
							filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?Type=Flash',
							filebrowserImageUploadUrl :'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
							filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						});
						</script>
                    </div>
                </div>
                
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="font-size:22px; color:#0E6BBB; width: 90%;">
                        English's Information
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Name(*)
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="text" name="ten_en" id="ten_en" style="width:520px; padding:0px;" value="<?php echo $record['ten_en']; ?>" />
                    </div>
                </div>
                <!--
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="width:710px; padding-bottom:3px;">
                        &nbsp; &nbsp; &nbsp;- Summary:
                    </div>
                    <div class="dangnhap_col_input" style="width:700px; padding-left:15px;">
                        <textarea id="tomtat_en" name="tomtat_en" rows="4" cols="30"><?php echo $record['tomtat_en']; ?></textarea>
                    	<script type="text/javascript">
						var editor = CKEDITOR.replace( 'tomtat_en',{
							uiColor : '#9AB8F3',
							language:'vi',
							skin:'office2003',
							//width:'200',
							filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?Type=Images',
							filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?Type=Flash',
							filebrowserImageUploadUrl :'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
							filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						});
						</script>
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="width:710px; padding-bottom:3px;">
                        &nbsp; &nbsp; &nbsp;- Content:
                    </div>
                    <div class="dangnhap_col_input" style="width:700px; padding-left:15px;">
                        <textarea id="noidung_en" name="noidung_en" rows="4" cols="30"><?php echo $record['noidung_en']; ?></textarea>
                    	<script type="text/javascript">
						var editor = CKEDITOR.replace( 'noidung_en',{
							uiColor : '#9AB8F3',
							language:'vi',
							skin:'office2003',
							//width:'200',
							filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?Type=Images',
							filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?Type=Flash',
							filebrowserImageUploadUrl :'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
							filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
						});
						</script>
                    </div>
                </div>
                -->
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title" style="font-size:22px; color:#0E6BBB; width: 90%;">
                        More Information
                    </div>
                </div>
                <!--
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Images:
                    </div>
                    <div class="dangnhap_col_input">
                        <input id="url_img" type="text" name="url_img" style="width:490px; padding:0px;" value="<?php echo $record['url_img']; ?>" />
                    	<input onclick="BrowseServer('Images:/','url_img')" type="button" name="btnChonFile" id="btnChonFile" value="...." />
                    </div>
                </div>
                -->
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Title
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="text" name="title" id="title" style="width:520px; padding:0px;" value="<?php echo $record['title']; ?>" />
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Keyword
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="text" name="keyword" id="keyword" style="width:520px; padding:0px;" value="<?php echo $record['keyword']; ?>" />
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Description
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="text" name="description" id="description" style="width:520px; padding:0px;" value="<?php echo $record['description']; ?>" />
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_title">
                        &nbsp; &nbsp; &nbsp;- Hidden or Show:
                    </div>
                    <div class="dangnhap_col_input">
                        <input type="radio" name="anhien" value="1" <?php if ($record['anhien']==1) echo "checked='checked'"; ?> />Show
                     	<input type="radio" name="anhien" value="0" <?php if ($record['anhien']==0) echo "checked='checked'"; ?> />Hidden
                    </div>
                </div>
                <div class="dangnhap_col">
                    <div class="dangnhap_col_input">
                        <input type="submit" class="ok" border="0" name="ok" id="ok" value="" />
                        <a href="javascript:history.go(-1);"><img src="imgs/exit_button.png" border="0" /></a>
                    </div>
                </div>
               	</form>